package com.quantsmart.springsecurityplus.service.impl;

import com.quantsmart.springsecurityplus.dao.RoleUserDao;
import com.quantsmart.springsecurityplus.entity.MyRoleUser;
import com.quantsmart.springsecurityplus.service.RoleUserService;
import com.quantsmart.springsecurityplus.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author codermy
 * @createTime 2020/7/10
 */
@Service("roleUserService")
public class RoleUserServiceImpl implements RoleUserService {
  @Autowired
  private RoleUserDao roleUserDao;

  @Override
  public Result getMyRoleUserByUserId(Integer userId) {
    List<MyRoleUser> tbRoleUser = roleUserDao.getMyRoleUserByUserId(userId);
    if(tbRoleUser != null){
      return Result.ok().data(tbRoleUser);
    }else{
      return Result.error();
    }
  }
}
